package com.whmskj.xjlhsc.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.github.pagehelper.util.StringUtil;
import com.whmskj.xjlhbc.core.Page;
import com.whmskj.xjlhsc.entity.EquipmentSpareParts;
import com.whmskj.xjlhsc.service.EquipmentsparepartsService;
import com.whmskj.xjlhsc.mapper.EquipmentsparepartsMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
* @author i
* @description 针对表【equipmentSpareParts】的数据库操作Service实现
* @createDate 2025-08-29 11:33:27
*/
@Service
public class EquipmentsparepartsServiceImpl extends ServiceImpl<EquipmentsparepartsMapper, EquipmentSpareParts>
    implements EquipmentsparepartsService{
    @Autowired
    private EquipmentsparepartsMapper equipmentsparepartsMapper;

    @Override
    public List<EquipmentSpareParts> wbbj(String letsGoLetsGoLetsGoLetsGoLetsGoLe, String type) {
        LambdaQueryWrapper<EquipmentSpareParts> equipmentSparePartsLambdaQueryWrapper = new LambdaQueryWrapper<>();
        equipmentSparePartsLambdaQueryWrapper.select(EquipmentSpareParts::getId,EquipmentSpareParts::getNameOfSpareParts);
        equipmentSparePartsLambdaQueryWrapper.eq(EquipmentSpareParts::getType, type);
        equipmentSparePartsLambdaQueryWrapper.eq(EquipmentSpareParts::getLetsGoLetsGoLetsGoLetsGoLetsGoLe,letsGoLetsGoLetsGoLetsGoLetsGoLe);
        List<EquipmentSpareParts> list = equipmentsparepartsMapper.selectList(equipmentSparePartsLambdaQueryWrapper);
        return list;
    }

    /**
     * 设备备件集合
     * @param keyWord
     * @return
     */
    @Override
    public List<EquipmentSpareParts> sbbjList(String keyWord,String type) {
        Page.startPage();
        LambdaQueryWrapper<EquipmentSpareParts> equipmentSparePartsLambdaQueryWrapper = new LambdaQueryWrapper<>();
        if (StringUtil.isNotEmpty(keyWord)){
            equipmentSparePartsLambdaQueryWrapper.like(EquipmentSpareParts::getNameOfSpareParts,keyWord);
        }
        if (StringUtil.isNotEmpty(type)){
            equipmentSparePartsLambdaQueryWrapper.eq(EquipmentSpareParts::getLetsGoLetsGoLetsGoLetsGoLetsGoLe, type);
        }
        List<EquipmentSpareParts> list = equipmentsparepartsMapper.selectList(equipmentSparePartsLambdaQueryWrapper);
        return list;
    }
}




